<?php
namespace Home\Controller;

use Think\Controller;

class JobController extends BaseController
{
    /**
     * 职位列表页，默认显示第一个分类
     *
     */
    public function index()
    {
        //职位显示
        $cat_id = I("get.cat_id", $category_list[0]['id']);

        $jobs_list = D("Jobs")->where("is_publish = 1")->order(array('sort_order' => "desc", 'id' => "asc"))->select();
        $data = array(
            "jobs_list" => $jobs_list,
            "menu" => "job"
        );
        $this->assign($data);
        $this->display();
    }

    public function info()
    {
        $id = I("post.id", 0);
        if (!empty($id)) {
            $job_info = D("Jobs")->where("id=$id")->find();
            $job_info['add_time'] = date("Y-m", $job_info['add_time']);

        }
        echo json_encode($job_info);
    }
}